<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" type="text/css" th:href="@{/assets/css/layui.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/assets/css/view.css}"/>
    <!-- import CSS -->
    <link rel="stylesheet" type="text/css" th:href="@{/assets/diyUpload/css/diyUpload.css}">
    <!-- diyUpload批量上传图片 -->
    <link rel="stylesheet" type="text/css" th:href="@{/assets/diyUpload/css/webuploader.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/assets/diyUpload/css/diyUpload.css}">
    <link rel="icon" href="/favicon.ico">
    <title>管理后台-影片管理</title>
</head>
<body class="layui-view-body">
    <div class="layui-content">
        <div class="layui-row">
            <div class="layui-card">
                <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
                    <legend><span th:text="${film.filmname}"></span> - 剧照</legend>
                </fieldset>
                <form id="film-form" class="layui-form layui-card-body" action="#" method="post">
                    <div id="demo" class="layui-form-item">
                        <div id="albums"></div>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <script th:src="@{/assets/layui.all.js}"></script>
    <script type="text/javascript" th:src="@{/js/jquery.min.js}"></script>
    <script type="text/javascript" th:src="@{/assets/diyUpload/js/webuploader.html5only.min.js}"></script>
    <script type="text/javascript" th:src="@{/assets/diyUpload/js/diyUpload.js}"></script>
    <script th:inline="javascript">
        /*<![CDATA[*/
        var contextPath = [[${#request.getContextPath()}]]; //获取当前应用路径
        var filmId = [[${film.id}]];
        /*]]>*/
    </script>
    <script>
        /*
        * 服务器地址,成功返回,失败返回参数格式依照jquery.ajax习惯;
        * 其他参数同WebUploader
        */
        $('#albums').diyUpload({
            url: contextPath + "/a/album/save?filmId=" + filmId,
            success:function( data ) {
                console.info( data );
            },
            error:function( err ) {
                console.info( err );
            },
            buttonText : '添加剧照',
            chunked:true,
            // 分片大小
            chunkSize:512 * 1024,
            //最大上传的文件数量, 总文件大小,单个文件大小(单位字节);
            fileNumLimit:50,
            fileSizeLimit:500000 * 1024,
            fileSingleSizeLimit:50000 * 1024,
            accept: {}
        });
    </script>
</body>
</html>